<template>
	<view>
		<button @click="changeLanguage">{{$t('changeLanguage')}}</button>
		<navigator url="/pages/chat/chat?userid=ldh&username=刘德华&meid=bin" open-type="navigate">聊天页面</navigator>
		<up-icon name="photo" color="#2979ff" size="28"></up-icon>
	</view>
	<cusTabbarVue></cusTabbarVue>
</template>

<script setup>
	import { ref } from 'vue';
import cusTabbarVue from '../../components/cus-tabbar/cus-tabbar.vue';
import request from '../../utils/request';
	import {
		useI18n
	} from 'vue-i18n';
import { func } from 'uview-plus/libs/function/test';
	const {
		locale
	} = useI18n()
	const changeLanguage = () => {
		const curLan = uni.getStorageSync('lan')
		const target = curLan === 'en' ? 'zh' : 'en'
		locale.value = target
		uni.setStorageSync('lan', target)
	}
	const houseList = ref([])
	const getList = () => {
		// 不二次封装的时候
		const token = uni.getStorageSync('token')
		uni.request({
			url: 'http://localhost:3020/getHouse',
			method:"GET",
			header: {
				token
			},
			data: {
				title: '朝阳'
			},
			success(res) {
				console.log(res)
				houseList.value = res.data.data.list
			}
		})
	}
	getList()
	
	
	const getData = () => {
			// 不二次封装的时候
		const token = uni.getStorageSync('token')
		uni.request({
			url: 'http://localhost:3020/getDetail',
			method:"GET",
			header: {
				token,
				'content-type': 'text'
			},
			data: {
				title: '朝阳'
			},
			success(res) {
				console.log(res)
				houseList.value = res.data.data.list
			}
		})
	}
	getData()
	
	const getDetail = () => {
		request({
			url: '/getDetail',
			method: 'get',
			data: {
				title: '昌平'
			},
			header: {'content-type': 'text'},
		}).then(res => {
			console.log(res)
		})
	}
	
	getDetail()
</script>

<style>

</style>